package com.medical.server.inhospital.controller;

import java.util.Arrays;
import java.util.Map;

import com.laozj.common.utils.PageUtils;
import com.laozj.common.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.medical.server.inhospital.entity.OpsInhospitalEntity;
import com.medical.server.inhospital.service.OpsInhospitalService;



/**
 * 
 *
 * @author laozj
 * @email laozj@medical.com
 * @date 2024-09-01 15:29:49
 */
@RestController
@RequestMapping("inhospital/opsinhospital")
public class OpsInhospitalController {
    @Autowired
    private OpsInhospitalService opsInhospitalService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = opsInhospitalService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
		OpsInhospitalEntity opsInhospital = opsInhospitalService.getById(id);

        return R.ok().put("opsInhospital", opsInhospital);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody OpsInhospitalEntity opsInhospital){
		opsInhospitalService.save(opsInhospital);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody OpsInhospitalEntity opsInhospital){
		opsInhospitalService.updateById(opsInhospital);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
		opsInhospitalService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
